cmake_minimum_required(VERSION 3.16)

project(usv_bridge VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.2 REQUIRED COMPONENTS Quick Qml Network Test QuickTest Positioning PositioningQuick QuickShapesPrivate)

qt_add_executable(appusv_bridge
    main.cpp
)

qt_add_qml_module(appusv_bridge
    URI usv_bridge
    VERSION 1.0
    QML_FILES
        Main.qml
        TopMenuBar.qml
        LeftPanel.qml
        RightPanel.qml
        UI/HDGSlider.qml
        UI/GPSShow.qml
        UI/SpeedShow.qml
        UI/DepthShow.qml
        UI/PitchAndRow.qml
        UI/OPENMAP.qml
        UI/Propulsion.qml
        UI/Control.qml
        UI/WayPointSet.qml
        UI/BingMap.qml
        UI/ThrustRowSlider.qml
        UI/ThrustColumnSlider.qml
        UI/ArcRudderSlider.qml
        UI/AnyArcRectCom.qml

    RESOURCES
        UI/Icon.png
        UI/right_icon_1.png
        UI/right_icon_2.png
        UI/right_icon_3.png
        UI/right_icon_4.png
        UI/compass/COG.png
        UI/compass/Compass_watchface.png
        UI/compass/Current.png
        UI/compass/Heading.png
        UI/compass/ROT.png
        UI/compass/Wind.png
        UI/compass/Setpoint.png
        UI/compass/container_icon.png
        UI/compass/Depth.png
        UI/compass/10-autopilot.png
        UI/compass/16-command-in.png
        UI/compass/Pitch-Roll-Heave-M-2.png
        UI/compass/propulsion-0.png
        UI/compass/thruster-component.png
        UI/compass/thruster-element.png
        UI/compass/CompassOnMap.png
        UI/compass/main-engine-component.png
        UI/compass/Rudder-arrow-S.png
        UI/compass/Rudder.png
        SOURCES Controller/systemcontroller.h Controller/systemcontroller.cpp
        SOURCES Controller/boatcontroller.h Controller/boatcontroller.cpp

)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appusv_bridge PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appusv_bridge
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appusv_bridge
    PRIVATE Qt6::Qml Qt6::Quick Qt6::Network Qt6::Test Qt6::QuickTest Qt6::Positioning Qt6::PositioningQuick Qt6::QuickShapesPrivate
)

include(GNUInstallDirs)
install(TARGETS appusv_bridge
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
